﻿using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Renren.Services;

namespace Renren.Models
{
    [DataContract]
    public class ResponseModel<T>
    {
        [DataMember(Name = "html_attributions")]
        public List<string> HtmlAttr { get; set; }

        [DataMember(Name = "results")]
        public List<T> Items { get; set; }

        public ResponseStatus? Status { get; set; }

        [DataMember(Name = "status")]
        public string StatusString
        {
            get { return Status == null ? null : Status.ToString(); }
            set
            {
                try
                {
                    Status = Enum.Parse(typeof(ResponseStatus), value, true) as ResponseStatus?;
                }
                catch (ArgumentException ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }
        }
    }
}
